

namespace("cx.plug.DragPan");

cx.plug.DragPan = function()
{
    /**
     * @constructor
     * 构造函数
     */
    var constructor = function()
    {
        cx.base(this, null);
    };

    /**
     * @method init
     * 初始化函数，重载基类函数
     */
    var destroy = function()
    {
        if(this.hasRuin)
            return;

        //销毁对象
        this.hasRuin = true;
        if(this.control)
        {
            this.control.destroy();
            this.control = null;
        }

        cx.base(this, "destroy");
    };

    /**
     * @method init
     * 初始化函数，重载基类函数
     */
    var init = function()
    {
        var self = this;
        cx.base(this, "init");

        this.control = new cx.map.control.ActDragPan({
            actMan: gMap.actMan
            , cursorClass: "cursor-dragPan"
            , onAftStop: function(){ self.onCtrDestroy(); }
        });
    };

    var start = function()
    {
        if(this.control.isRun())
            return;
        this.control.start();
    };

    cx.inherits(constructor, cx.plug.IPlugAct);

    var prototype = constructor.prototype;
    prototype.destroy = destroy;
    prototype.init = init;
    prototype.start = start;
    return constructor;
}();

